module SRI
  class Scope
    def initialize( outer = nil )
      @outer = outer
      @scope = {}
    end
    
    def []( var )
      if @scope.has_key? var
        @scope[var]
      elsif @outer.nil?
        nil
      else
        @outer[var]
      end
    end
    
    def []=( var, value )
      @scope[var] = value
    end
    
    def member?( var )
      @scope[var].nil?
    end
  end
end
